package com.itheima.iostream;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

public class ObjectOutputStream01 {
    public static void main(String[] args){
        ObjectOutputStream oos = null;
        try{
            oos = new ObjectOutputStream(new FileOutputStream("E:\\Java_pro\\oop\\src\\com\\itheima\\iostream\\serializable"));
            Student zs = new Student("张三",001,17);
            oos.writeObject(zs);

            oos.flush();
        }catch(Exception e){
            e.printStackTrace();
        }finally{
            try{
                oos.close();
            }catch(Exception e){
                e.printStackTrace();
            }
        }

    }


}



class Student implements Serializable {
    String name;
    int no;
    int age;

    public Student(){}
    public Student(String name,int no,int age){
         this.name =name;
         this.no=no;
         this.age =age;
    }

    public String toString(){
        return "Student{name:"+name+",no:"+no+",age:"+age+"}";
    }




}